home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / inet / ien / ien-108 < prev    next >
Encoding:
Text File  |  1988-12-01  |  14.8 KB  |  552 lines

  1.  
  2. Internet Experiment Note 108
  3.  
  4.  
  5.  
  6.                       Internet User Queues
  7.  
  8.  
  9.  
  10.                        William W. Plummer
  11.  
  12.  
  13.                   Bolt Beranek and Newman, Inc.
  14.                         50 Moulton Street
  15.                       Cambridge MA   02138
  16.  
  17.  
  18.                           19 June 1979
  19.  
  20.  
  21.  
  22.  
  23.  
  24.                       Internet User Queues
  25. William W. Plummer                                   19 June 1979
  26.  
  27.  
  28. The Internet JSYSes provide a facility for user programs to  send
  29. and  receive  Internet packets.  This set of calls is parallel to
  30. the "IMP special queue" calls, which dealt only with the ARPANET.
  31.  
  32. In order to use the Internet calls a program must first assign an
  33. Internet Queue using ASNIQ (JSYS 756).  The  arguments  for  this
  34. JSYS  are  a  set  of  mask  and  value words that determine what
  35. messages may be sent and which of the incoming messages  will  be
  36. delivered  to  the owning job.  A successful ASNIQ returns with a
  37. handle (a small number, short-hand for the queue),  in  T1  which
  38. can  then  be  fed  to  SNDIN  and  RCVIN (SeND InterNet, ReCeiVe
  39. InterNet).
  40.  
  41. The arguments for SNDIN  are  an  Internet  Queue  Handle  and  a
  42. pointer  to  a  buffer  of data in the caller's space.  Word-0 of
  43. this buffer is the size of the buffer, including this count word.
  44. Words 1 through 5 must have a Version 4 Internet Header (see last
  45. page).  Various fields of the header are  checked  for  legality,
  46. the  source  host word is filled in, the Internet header checksum
  47. inserted.  Then a network  interface  is  selected  and  a  local
  48. leader for that network is constructed in the packet.  The packet
  49. is then queued for output on that interface and SNDIN returns.
  50.  
  51. Basically, users have no control over which interface is selected
  52. for packet output and no knowledge of which interface an incoming
  53. packet  arrived on.  This is analogous to the ARPANET where users
  54. have no control over which IMPs a message actually goes  through.
  55. There  is  an  exception  when  a  system is equipped with a "Raw
  56. Packet Interface" (RPI) which is used  to  connect  to  a  remote
  57. gateway  or  a encryption device (such as a BCR).  Bit zero in T1
  58. to ASNIQ will flag the queue as using the  RPI  rather  than  the
  59. normal interfaces.
  60.  
  61. RCVIN  takes  the  same arguments, an Internet Queue Handle and a
  62. buffer pointer.  Normally, if no messages are already waiting  on
  63. the  queue, RCVIN waits.  This wait can be defeated by turning on
  64. the "don't wait" control bit which forces an error return  if  no
  65. messages  are  waiting.   When  a  message  is  available,  it is
  66. delivered to the user- supplied  buffer.   The  number  of  words
  67. filled  is  set  into the left half of word-0 (the count word) of
  68. the buffer.  Ordinarily this can be ignored, but if  the  message
  69. was  too big for the buffer, this tells how much space would have
  70. been required.
  71.  
  72. When finished, the queue handle can be released by  using  RELIQ.
  73. All  handles  owned by the job may be released by supplying -1 as
  74. the argument.
  75.  
  76.  
  77.  
  78.                               - 1 -
  79.  
  80.  
  81.  
  82.  
  83.  
  84.                       Internet User Queues
  85. William W. Plummer                                   19 June 1979
  86.  
  87.  
  88. All Internet JSYS calls use only the left 32 bits of  each  word.
  89. This  is  true  of  both  the  ASNIQ  argument  block and of data
  90. buffers.
  91.  
  92.  
  93. Messages  left  waiting  on  an  input  queue  for  a  long  time
  94. (currently  30  seconds)  will  be deleted.  Also, a queue cannot
  95. hold very many messages (32, today).  Flooding an Internet  input
  96. queue to a slow receiver will result in dropped messages.
  97.  
  98. Messages  addressed  to  the  sending  host  will  ordinarily  be
  99. delivered without  sending  over  any  network  at  all  and  are
  100. reasonably fast.
  101.  
  102. User  programs have no control over which network a given message
  103. will be sent out over.  This decision will be made  by  the  host
  104. gateway module on the basis of routing information supplied to it
  105. by  other  Internet  gateways.   This  means that all networks to
  106. which  a  host  is  connected  must  go  down   before   Internet
  107. communications  will  be completely stifled, and even then, forks
  108. within a job will  be  able  to  communicate  due  to  the  local
  109. delivery mechanism.
  110.  
  111. Programs  using Internet messages must be aware that messages are
  112. not necessarily delivered in the order in which they  were  sent,
  113. some  messages  may  be  dropped and others duplicated.  Some may
  114. traverse a broadcast network and be clobbered by  other  packets,
  115. lightning,  flaky  intermediate gateways, etc.  Thus, some higher
  116. level protocol is needed in most cases.  TCP is one example,  but
  117. there are others (the "Datagram Protocol", XNET, etc.).
  118.  
  119. If  a  particular  protocol  is implemented in the monitor (e.g.,
  120. TCP) and that protocol module is turned on, no messages  of  that
  121. protocol  type  will  be  passed  to  users  via Internet queues.
  122. Assigning a queue will still be possible,  but  no  traffic  will
  123. reach the user unless that protocol module is disabled.
  124.  
  125.  
  126. Not  all  Internet protocols have ports.  If you are implementing
  127. one which does not, be  sure  that  .IQPTM  in  the  ASNIQ  block
  128. contains  a  zero.  If the protocol uses ports, they are expected
  129. to be in the  first  two  16-bit  bytes  following  the  Internet
  130. header,  source  port  first  and  destination  port second.  The
  131. location of this word is found by  adding  the  contents  of  the
  132. Internet  data  offset field to the address of the zeroth word of
  133. the Internet header.
  134.  
  135.  
  136.  
  137.  
  138.                               - 2 -
  139.  
  140.  
  141.  
  142.  
  143.  
  144.                       Internet User Queues
  145. William W. Plummer                                   19 June 1979
  146.  
  147.  
  148. An additional feature of the Internet Queue Mechanism is that  it
  149. (optionally)  provides  an  logical  host  capability.   That is,
  150. incoming messages can be demultiplexed on the basis  of  bits  in
  151. the  Internet  Destination  Host  field.   Exactly which bits are
  152. considered logical host specifier  bits  depends  on  the  naming
  153. conventions  in  force in the network (area) to which the host in
  154. question is connected.  For ARPANET hosts, the middle 8-bit  byte
  155. of  the 24-bit Internet Host is considered to be the logical host
  156. specifier.
  157.  
  158. ASNIQ takes a specification of what numbers are to be used in the
  159. logical host bits of the source address  for  packets  which  are
  160. sent  and received.  When a packet is sent, the logical host bits
  161. are obtained  from  the  user's  packet  and  combined  with  the
  162. Internet  Host  Identifier  for  the  host being used, the result
  163. being  inserted  into  the  Source  Host  field  of  the  packet.
  164. Incoming packets are accepted by the Internet Layer if they match
  165. the Internet Host Identifier (Name) when the logical host bits of
  166. the destination address have been set to zero.
  167.  
  168. It  is  illegal to assign an Internet Queue such that the Logical
  169. host mask includes any bits which are not  part  of  the  logical
  170. host field.  ASNIQ will give an error return in this case.
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.                               - 3 -
  199.  
  200.  
  201.  
  202.  
  203.  
  204.                       Internet User Queues
  205. William W. Plummer                                   19 June 1979
  206.  
  207.  
  208. Assign Internet Queue JSYS
  209.  
  210. ;T1/    Pointer to queue descriptor block
  211. ;       (Bit-0: use Raw Packet Interface)
  212. ;T2/    (Unused, must be 0)
  213. ;T3/    (Unused, must be 0)
  214. ;
  215. ;       ASNIQ           (JSYS 756)
  216. ;Ret+1:  Failed.  Error code in T1.
  217. ;Ret+2: Success.  Internet queue handle in T1.
  218.  
  219. Format of a queue descriptor block:
  220.  
  221.         Word offset     Name    Contents
  222.  
  223.              0          .IQPRV  Internet protocol number in
  224.                                 bit 24-31.  Others should be 0.
  225.  
  226.              1          .IQFHV  Internet foreign host value word in
  227.                                 bits 0-31.
  228.  
  229.              2          .IQSHV  Internet source host value word in
  230.                                 bits 0-31.  Used for logical host selection.
  231.  
  232.              3          .IQPTV  Internet port value word.  Local port
  233.                                 value in bits 0-15, foreign port in 16-31.
  234.  
  235.              4          .IQPRM  Mask word corresponding to .IQPRV.
  236.  
  237.              5          .IQFHM  Mask word corresponding to .IQFHV
  238.  
  239.              6          .IQSHM  Mask word corresponding to .IQSHV
  240.  
  241.              7          .IQPTM  Mask word corresponding to .IQPTV
  242.                                 (Use 0 for portless protocols)
  243.  
  244. The  mask  words specify those bit positions where an exact match
  245. is required.  Thus, one can make  .IQFHM  contain 0 in  order  to
  246. talk  to  all Internet hosts.  Or by making say the low 3 bits of
  247. the local port mask word be 0, one owns eight ports.   Note  that
  248. an error will result unless the current QDB differs in the masked
  249. in  bits from all other Internet queues which are assigned at the
  250. instant the ASNIQ is issued.
  251.  
  252. Possible errors:
  253.  
  254. 600737,NTWZX1,NET WIZARD capability  required
  255. 600740,ASNSX1,All Internet queues in use
  256.  
  257.  
  258.                               - 4 -
  259.  
  260.  
  261.  
  262.  
  263.  
  264.                       Internet User Queues
  265. William W. Plummer                                   19 June 1979
  266.  
  267.  
  268. 600741,ASNSX2,Conflict with some other job (# in AC2)
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.                               - 5 -
  319.  
  320.  
  321.  
  322.  
  323.  
  324.                       Internet User Queues
  325. William W. Plummer                                   19 June 1979
  326.  
  327.  
  328. Release Internet Queue JSYS
  329.  
  330. ;T1/    An Internet Queue Handle or -1 for all
  331. ;T2/    (Not used.  Must be 0)
  332. ;T3/    (Not used.  Must be 0)
  333. ;
  334. ;       RELIQ   (JSYS 757)
  335. ;Ret+1:  Failure.  Error code in T1.
  336. ;Ret+2: Success.
  337.  
  338. This JSYS releases ownership of an Internet queue so  that  other
  339. jobs  can  assign  it.   Note that neither the RESET JSYS nor the
  340. EXEC RESET command execute RELIQs.   Thus,   once  the  queue  is
  341. assigned, it stays assigned until the job logs out.
  342.  
  343. Possible errors:
  344.  
  345. 600742,SQX1,Internet queue handle out of range
  346. 600743,SQX2,Internet queue not assigned
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.                               - 6 -
  379.  
  380.  
  381.  
  382.  
  383.  
  384.                       Internet User Queues
  385. William W. Plummer                                   19 June 1979
  386.  
  387.  
  388. Send an Internet Message JSYS
  389.  
  390. ;T1/    Internet Queue Handle
  391. ;T2/    Pointer to buffer containing message
  392. ;T3/    (Not used. Must be 0.)
  393. ;
  394. ;       SNDIN   (JSYS 754)
  395. ;Ret+1:  Failure.  Error code in T1.
  396. ;Ret+2: Success.
  397.  
  398. The buffer must contain a word count in the right half of word-0,
  399. a  valid  Internet header in words 1 through 5, and possibly some
  400. data in words 6 and following.  If port filtering is  being  used
  401. (.IQPTM was non-zero for ASNIQ), the ports must be located in the
  402. word  following the Internet header.  The address of this word is
  403. found by adding the address of word-1 in the buffer to the number
  404. in the Internet data offset field.
  405.  
  406. The monitor fills in the source host field in the packet and also
  407. the Internet header checksum.  The rest of the header is what  is
  408. supplied by the user.
  409.  
  410. Possible errors:
  411.  
  412. 600742,SQX1,Internet queue handle out of range
  413. 600743,SQX2,Internet queue not assigned
  414. 600732,SNDIX1,Invalid message size
  415. 600733,SNDIX2,Insufficient system resources (No buffers available)
  416. 600735,SNDIX4,Invalid header value for this queue
  417.                 (Includes Internet Packet Length too big, Data offset
  418.                 too small, filtering on ports but packet length says
  419.                 packet does not contain a port word, and header does
  420.                 not fit the ASNIQ arguments).
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.                               - 7 -
  439.  
  440.  
  441.  
  442.  
  443.  
  444.                       Internet User Queues
  445. William W. Plummer                                   19 June 1979
  446.  
  447.  
  448. Receive Internet Message JSYS
  449.  
  450.  
  451. ;T1/    Flags,,Internet Queue Handle
  452. ;               Bit-0: On to cause fail return instead of waiting
  453. ;T2/    Pointer to buffer where message will be put
  454. ;T3/    (Not used.  Must be 0.)
  455. ;
  456. ;       RCVIN   (JSYS 755)
  457. ;Ret+1:  Failure.  Error code in T1.
  458. ;Ret+2: Success.
  459.  
  460. Each RCVIN gets one message from the named queue.  These messages
  461. match the values in the queue descriptor block when masked by the
  462. mask  words  in  the  block.  The number of words filled plus one
  463. (counting the count word) is placed in the left half of word-0 of
  464. the buffer.  If the message was too  big  as  determined  by  the
  465. Internet  data length field, as much as will fit in the buffer is
  466. transferred and an error return given.  No  retry  for  the  same
  467. message is possible.
  468.  
  469. Possible errors:
  470.  
  471. 600742,SQX1,Internet queue handle out of range
  472. 600743,SQX2,Internet queue not assigned
  473. 600732,SNDIX1,Invalid message size
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.                               - 8 -
  499.  
  500.  
  501.  
  502.  
  503.  
  504.                       Internet User Queues
  505. William W. Plummer                                   19 June 1979
  506.  
  507.  
  508. ; The following structure definitions have been excerpted from
  509. ; the file INPAR.MAC which is used in building TENEX and TOPS20
  510. ; monitors with Internet code.  Those who are unfamiliar with the
  511. ; structure facility should refer to SYS:MACSYM.MAC.  Basically,
  512. ; DEFSTR(Name,Location,Bit,Size)  defines a structure called Name.
  513. ; This field is held in the word (possibly an index) at Location.
  514. ; The right-hand bit number is Bit and the field is Size bits wide.
  515. ; A typical reference to the data offset field might be:   LOAD T1,PIDO,(PKT)
  516. ; where PKT is an index register which points at the zero-th word
  517. ; of the structure.
  518. ; Word offsets:
  519.  
  520.  .IPKVR==0              ; Word with version, type of service, etc
  521.  .IPKSG==1              ; Word with segmentation info
  522.  .IPKPR==2              ; Word with time to live, checksum, protocol
  523.  .IPKSH==3              ; Word with source host
  524.  .IPKDH==4              ; Word with destination host
  525.  
  526. DEFSTR(PIVER,.IPKVR,3,4)        ; PACKET.INTERNET.VERSION
  527. DEFSTR(PIDO,.IPKVR,7,4)         ; PACKET.INTERNET.DATA-OFFSET
  528. DEFSTR(PITOS,.IPKVR,15,8)       ; PACKET.INTERNET.TYPE-OF-SERVICE
  529.   ; Overlays for the above:
  530.   DEFSTR(PIPRI,.IPKVR,9,2)      ; PACKET.INTERNET.PRIORITY
  531.   DEFSTR(PISVD,.IPKVR,10,1)     ; PACKET.INTERNET.STREAM-VS-DATAGRAM
  532.   DEFSTR(PIREL,.IPKVR,12,2)     ; PACKET.INTERNET.RELIABILITY
  533.   DEFSTR(PISVR,.IPKVR,13,1)     ; PACKET.INTERNET.SPEED-VS-RELIABILITY
  534.   DEFSTR(PISPD,.IPKVR,15,2)     ; PACKET.INTERNET.SPEED-OF-DELIVERY
  535. DEFSTR(PIPL,.IPKVR,31,16)       ; PACKET.INTERNET.PACKET-LENGTH
  536. DEFSTR(PISID,.IPKSG,15,16)      ; PACKET.INTERNET.SEGMENT-ID
  537. DEFSTR(PIFLG,.IPKSG,18,3)       ; PACKET.INTERNET.FLAGS
  538.   ; Overlays for the above:
  539.   ; Unused bit
  540.   DEFSTR(PIDF,.IPKSG,17,1)      ; PACKET.INTERNET.DONT-FRAGMENT
  541.   DEFSTR(PIMF,.IPKSG,18,1)      ; PACKET.INTERNET.MULTIFRAGMENT
  542. DEFSTR(PIFO,.IPKSG,31,13)       ; PACKET.INTERNET.FRAGMENT-OFFSET
  543. DEFSTR(PITTL,.IPKPR,7,8)        ; PACKET.INTERNET.TIME-TO-LIVE
  544. DEFSTR(PIPRO,.IPKPR,15,8)       ; PACKET.INTERNET.PROTOCOL
  545. DEFSTR(PICKS,.IPKPR,31,16)      ; PACKET.INTERNET.HEADER-CHECKSUM
  546. DEFSTR(PISH,.IPKSH,31,32)       ; PACKET.INTERNET.SOURCE-HOST
  547.   ; Overlays for above:
  548.   DEFSTR(PISHN,.IPKSH,7,8)      ; PACKET.INTERNET.SOURCE.NET
  549.   DEFSTR(PISHT,.IPKSH,31,24)    ; PACKET.INTERNET.SOURCE.HOST
  550. DEFSTR(PIDH,.IPKDH,31,32)       ; PACKET.INTERNET.DESTINATION-HOST
  551.   ; Overlays for above:
  552.   DEFSTR(PIDHN,.IPKDH,7,8)      ; PACKET.INTERNET.DESTINATION.NET
  553.   DEFSTR(PIDHT,.IPKDH,31,24)    ; PACKET.INTERNET.DESTINATION.HOST
  554.  
  555.  
  556.  
  557.  
  558.                               - 9 -
  559.  
  560.  
  561. -------
  562.